package com.sky.controller.common;


import com.sky.result.Result;
import com.sky.service.KeysService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author majun
 * @package com.sky.controller.common
 * @date 2024/11/20 16:52
 */

@Slf4j
@RestController
@RequestMapping("/key")
public class KeysController {

    @Autowired
    private KeysService keysService;

    /**
     * 获取用于前端加密的公钥
     *
     * @param userId
     * @return
     * @throws Exception
     */
    @PostMapping("/getRsaPublicKey")
    public Result getRsaPublicKey(String userId) throws Exception {

        log.info("获取用于前端加密的公钥");

        String a = keysService.getRsaPublicKey(userId);

        return Result.success(a);

    }


}
